<layout-header></layout-header>

<nav class="container-xl mb-3">
    <ol class="breadcrumb">
        <li class="breadcrumb-item"><a routerLink="/welcome">首页</a></li>
        <li class="breadcrumb-item active">模型配置</li>
    </ol>
</nav>

<div class="container-xl mb-3">
    <div class="text-end mb-3">
        <button class="btn btn-primary" [routerLink]="['/llmodel/create']">添加</button>
    </div>

    <table class="table table-hover align-middle">
        <thead class="table-light">
            <tr>
                <th scope="col">#</th>
                <th scope="col">指令</th>
                <th scope="col">模型</th>
                <th scope="col" class="d-none d-md-table-cell">级别</th>
                <th scope="col" class="d-none d-lg-table-cell">族类</th>
                <th scope="col" class="d-none d-md-table-cell">供应商</th>
                <th scope="col" class="d-none d-xl-table-cell">接入点</th>
                <th scope="col">操作</th>
            </tr>
        </thead>
        <tbody>
            @for (item of llmodels; track item.rd) {
            <tr>
                <th scope="row">{{item.rd}}</th>
                <td>{{item.mid}}</td>
                <td>{{item.model}}</td>
                <td class="d-none d-md-table-cell">
                    {{userLevels[item.level] && userLevels[item.level].name || '-'}}
                </td>
                <td class="d-none d-lg-table-cell">{{item.family}}</td>
                <td class="d-none d-md-table-cell">{{item.provider}}</td>
                <td class="d-none d-xl-table-cell">{{item.endpoint}}</td>
                <td class="text-nowrap">
                    <button class="btn btn-sm btn-primary me-2" routerLink="/llmodel/update/{{item.rd}}">编辑</button>
                    <button class="btn btn-sm btn-danger me-2" (click)="deleteLLModel(item)">删除</button>
                </td>
            </tr>
            }
        </tbody>
    </table>
</div>